package com.qf.controller;

import com.qf.pojo.entity.StoreCollect;
import com.qf.pojo.resp.BaseResp;
import com.qf.service.CollectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName CollectController
 * @Description TODO
 * @Author 非乐
 * @Date 2022/9/28 20:27
 * @Version 1.0
 **/
@RestController
@RequestMapping("collect")
@Api(tags = "店铺收藏管理")
public class CollectController {

    @Autowired
    CollectService collectService;

    @PostMapping("fav")
    @ApiOperation("添加店铺收藏(userId,storeId必传)")
    public BaseResp addCollect(@RequestBody StoreCollect collect){
        return collectService.addCollect(collect);
    }

    @PostMapping("unfav")
    @ApiOperation("取消店铺收藏(userId,storeId必传)")
    public BaseResp delCollect(@RequestBody StoreCollect collect){
        return collectService.delCollect(collect);
    }

    @GetMapping("favlist")
    @ApiOperation("商品店铺列表(userId必传)")
    public BaseResp favList(int userId){
        return collectService.favList(userId);
    }

}
